#pragma once


// CWndTimeBar
#include "TimeTip.h"
#include "../_inc_arc/def_archive.h"
#include "../_inc/def_interface.h"

class CWndTimeBar : public CWnd
{
	DECLARE_DYNAMIC(CWndTimeBar)

public:
	CWndTimeBar();
	virtual ~CWndTimeBar();

protected:
	DECLARE_MESSAGE_MAP()

private:
	enum _TAG_LOAD
	{
		UNLOADED = 0,
		LOADED,
		LOAD_COUNT
	};

	CBitmap m_bmpLeft[LOAD_COUNT];
	CBitmap m_bmpRight[LOAD_COUNT];
	CBitmap m_bmpMid[LOAD_COUNT];
	CBitmap m_bmpIndicator;

	HBITMAP m_htimebar_left_diabled;
	HBITMAP m_htimebar_left_enabled;
	HBITMAP m_htimebar_right_disabled;
	HBITMAP m_htimebar_right_enabled;
	HBITMAP m_htimebar_mid_disabled;
	HBITMAP m_htimebar_mid_enabled;
	HBITMAP m_htimebar_thumb;

	int m_nStatus;
	int m_nPos;
	int m_nSelPos;
	int m_nCurPos;

	time_t m_tStart, m_tEnd;
	time_t m_tCurPlayTime;
	time_t m_tSelTime;
	int m_nMidStart, m_nMidEnd;
	int m_nThumbLen;
	int m_nLength;
	BOOL m_bShow;
	BOOL m_bThumbUp;
	CRect m_rtThumb;

	CTimeTip m_cTip;

	IFRAMEINDEX *m_pIFrameIndex;
	DWORD m_dwIFrameIndexSize;

	//void DrawTimeBar(CPaintDC *pDC, int nPos);
	void DrawTimeBar(CDC *pDC, int nPos);
	void DrawLoadingTimeBar(CDC *pDC, int nTotalLength, int nPos);
	void ShowTip(BOOL bShow, CPoint point);

public:
	void SetPlayBlockTime(time_t tStart, time_t tEnd);
	void SetPlayInfo(time_t tPlay);

	void SetPlayIFrameInfo(int nTotalIFrameCount);
	void SetPlayInfo(int nIFrameCount);

	void SetPlayStatus(BOOL bPlayOn);
	void LoadTimeBar(LPST_TIMEBAR_LOAD_DATA lpData);

public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnPaint();
	afx_msg void OnDestroy();
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseLeave();
};


